#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
# @FileName  :route_users.py
# @Time      :2022/4/22 3:40 PM
# @Author    :Toliong toliong@foxmail.com
"""
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session

from schemas.users import UserCreate, ShowUser
from db.session import get_db
from backend.db.repository.users import create_new_user
from core.config import lg


router = APIRouter()


@router.post("/", response_model=ShowUser)
def create_user(user: UserCreate, db: Session = Depends(get_db)):
    lg.info("user create")
    user = create_new_user(user=user, db=db)
    lg.info("create user complete")
    return user


if __name__ == "__main__":
    pass
